<?php

namespace app\admin\model;

use think\Model;

class Bkuser extends Model
{
    // 表名
    protected $name = 'bkuser';
    
    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'int';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = false;
    
    // 追加属性
    protected $append = [
        'companylist_text',
        'gender_text',
        'typelist_text'
    ];
    

    
    public function getCompanylistList()
    {
        return ['1' => __('Companylist 1'),'2' => __('Companylist 2'),'3' => __('Companylist 3'),'4' => __('Companylist 4'),'5' => __('Companylist 5'),'6' => __('Companylist 6')];
    }     

    public function getGenderList()
    {
        return ['1' => __('Gender 1'),'2' => __('Gender 2')];
    }     

    public function getTypelistList()
    {
        return ['1' => __('Typelist 1'),'2' => __('Typelist 2')];
    }     


    public function getCompanylistTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['companylist']) ? $data['companylist'] : '');
        $list = $this->getCompanylistList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getGenderTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['gender']) ? $data['gender'] : '');
        $list = $this->getGenderList();
        return isset($list[$value]) ? $list[$value] : '';
    }


    public function getTypelistTextAttr($value, $data)
    {        
        $value = $value ? $value : (isset($data['typelist']) ? $data['typelist'] : '');
        $list = $this->getTypelistList();
        return isset($list[$value]) ? $list[$value] : '';
    }




}
